//  ---------------------- Doxygen info ----------------------
//! \file Doxygen_TypeII_SynchronizationBehavior.h
//!
//! \brief
//! Documentation file for Doxygen (description of synchronization behavior)
//!
//! \date April 2015
//! 
//! \version 1.2.7
//!
//! \author Torsten Kroeger, <info@reflexxes.com> \n
//! 
//!
//! \copyright Copyright (C) 2015 Google, Inc.
//  ----------------------------------------------------------
//   For a convenient reading of this file's source code,
//   please use a tab width of four characters.
//  ----------------------------------------------------------



// -----------------------------------------------------------------
/*!
\page page_SynchronizationBehavior Synchronization Behavior

<b>Contents of this page:</b>\n\n

- \ref sec_SyncBehaviorIntroduction

- \ref sec_PositionBasedSyncronizazion

- \ref sec_VelocityBasedSyncronizazion
 
\n

<hr>

\section sec_SyncBehaviorIntroduction Introduction

The On-Line Trajectory Generation (OTG) algorithms of the Reflexxes Motion
Libraries are capable to generate

- <b>non-synchronized</b>,

- <b>time-synchronized</b>, and

- <b>phase-synchronized</b>

motion trajectories.

\n\n

\image html OTGPSIntro.png "Paths of non-, time-, and phase-synchronized trajectories for a two-degree-of-freedom system."

\n

While the generation of non-synchronized and time-synchronized trajectories
is always possible for both, the position-based and the velocity-based 
On-line Trajectory Generation algorithm, phase-synchronized trajectories
require certain input values. The following image shows a non-, a
time-, and phase-synchronized trajectory for three degrees of freedom.

\n\n

\image html NSTSPS.png "Non-synchronized, time-synchronized, and phase-synchronized trajectories for a system with three degrees of freedom."

\n

To specify the behavior of the Reflexxes Motion Library, the enumeration
RMLFlags::SyncBehaviorEnum consists of four 
elements

- RMLFlags::NO_SYNCHRONIZATION,
- RMLFlags::PHASE_SYNCHRONIZATION_IF_POSSIBLE,
- RMLFlags::ONLY_TIME_SYNCHRONIZATION, and
- RMLFlags::ONLY_PHASE_SYNCHRONIZATION,

and the attribute RMLFlags::SynchronizationBehavior is used to specify the 
synchronization behavior of the desired trajectory.\n\n

Detailed information
about the flag RMLFlags::PHASE_SYNCHRONIZATION_IF_POSSIBLE can be found
on page \ref page_PSIfPossible.

\n\n

\n

<hr>

\section sec_PositionBasedSyncronizazion Synchronization Behavior of the Position-based On-line Trajectory Generation Algorithm

All four values of the set RMLFlags::SyncBehaviorEnum can be
used to specify the synchronization behavior of the position-based On-Line
Trajectory Generation algorithm (cf. ReflexxesAPI::RMLPosition()).\n\n


An example showing, how to set-up time- and phase-synchronized motion
trajectories, is shown at page
\ref page_Code_03_RMLPositionSampleApplication. The resulting time- and
phase-synchronized trajectories and paths of the two degrees of freedom of
this example are depicted in the following figure.

\n\n

\image html TimeAndPhaseSynchronizationInputValues.png " "

\n

\image html TimeAndPhaseSynchronization.png " "

\n

\image html TimeAndPhaseSynchronizationXY.png "Example of a two-degree-of-freedom time- and phase-synchronized motion trajectory (top) and corresponding paths (bottom) generated by the \em position-based Type IV On-Line Trajectory Generation algorithm of the Reflexxes Motion Libraries using the same input values (Type IV)."

\n\n

In this example, the task is to execute a motion from standstill, which
is defined by
\f$ {\bf W}_0\,=\,\left(\,\!_1\vec{W}_0,\,_2\vec{W}_0\right)^T \f$. After
1000 ms, a sensor event happens (unforeseen), and due to this, we have to
immediately react and now have to reach a position ahead with a negative
velocity. This desired state of motion, \f$ {\bf M}_{1000}^{\,trgt} \f$,
is time-optimally reached after \f$ t\,=\,3873\,ms \f$ (cf. figure above),
and right after this, a further switching of set-points happens, such that
the originally desired state of motion, \f$ {\bf M}_0^{\,trgt} \f$, shall be
reached again. After \f$ t\,=\,6756\,ms \f$, this desired state is finally
reached (cf. \ref page_Code_03_RMLPositionSampleApplication).

\n\n

\n

<hr>

\section sec_VelocityBasedSyncronizazion Synchronization Behavior of the Velocity-based On-line Trajectory Generation Algorithm

The velocity-based On-Line Trajectory Generation algorithm (cf.
ReflexxesAPI::RMLVelocity()) can also generate

- <b>non-synchronized</b>,
- <b>time-synchronized</b>, or
- <b>phase-synchronized</b>,

and accepts any values of RMLFlags::SyncBehaviorEnum. The default value for
the corresponding flag RMLVelocityFlags::SynchronizationBehavior is
RMLFlags::NO_SYNCHRONIZATION. The following image shows an example for
a non-synchronized and a time-synchronized trajectory using the same input
values \f$ {\bf W}_0 \f$.

\n\n



\n\n

\image html VelocityTimeAndNonSynchronizedValues.png " "

\n

\image html VelocityTimeAndNonSynchronized.png "Example of a Three-degree-of-freedom trajectory generated by the velocity-based On-line Trajectory Generation algorithm. The left trajectory is non-synchronized;the right one is time-synchronized (Type IV)."

\n

\note
<b>The examples above have been generated with the Type IV Reflexxes Motion
Library, which takes into account the values of</b>\n\n
<ul>
    <li>RMLPositionInputParameters::CurrentAccelerationVector
    (containing the the current acceleration vector \f$ \vec{A}_i\f$
      and</li>
    <li>RMLPositionInputParameters::MaxJerkVector
    (containing the maximum jerk vector \f$ \vec{J}_i^{\,max} \f$.
      \n\n</li>
</ul>

\n

*/

